<?php
ini_set('display_errors', 0);
  session_start();  
$_SESSION['usuarios'];
$_SESSION['passwords'];

if ($_SESSION['usuarios'] == "" and $_SESSION['passwords'] == ""){
	echo " uste no tiene permiso pa ver esta pagina";
	die;
}
$usuarios6 = $_SESSION['usuarios'];
?>
<?php 
include 'conex.php';
$nac = $_REQUEST['nac'];
$cedula_usu = $_REQUEST['cedula_usu'];
date_default_timezone_set('America/Caracas');
$ip = $_SERVER['REMOTE_ADDR'];
$ano = date('Y');
$mes = date('m');
$dia = date('d');
$hora = date('h:i:s A');

$query= "INSERT INTO historico_movimiento (usuario, tipo_movimiento, dia, mes, ano, hora, ip, tabla, descripcion) 
VALUES ('$usuarios6','2','$dia','$mes','$ano','$hora','$ip','user_login','$cedula_usu');";
pg_query($query) or die ('Error insertando');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<title> Sistema Integral de Bienestar Social</title>
<link href="media/styles00.css" rel="stylesheet" type="text/css" />
<link href="media/nivo-sli.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="media/jquery-1.js"></script>
<script type="text/javascript" src="media/jquery00.js"></script>
<script src="media/cufon-yu.js" type="text/javascript"></script>
<script src="media/Sunshine.js" type="text/javascript"></script>
<script type="text/javascript">
Cufon.replace('h1');
Cufon.replace('h3');
Cufon.replace('.special_font');
Cufon.replace('h2 a', {
	hover: true
});
Cufon.replace('h2');
Cufon.replace('#navigation a', {
	hover: true
});
</script>
<script type="text/javascript" src="media/jquery01.js"></script>
<script type="text/javascript">
$(window).load(function() {
$('#slider').nivoSlider();
});
</script>
<!--[if IE 6]><script defer type="text/javascript" src="js/pngfix.js"></script><![endif]-->
<!--[if !IE 7]>
<style type="text/css">
#bg_top {display:table;height:100%}
h1 {padding-top:5px;}
</style>
<![endif]-->
<link rel="stylesheet" href="media/jquery00.css" type="text/css" />
<script type="text/javascript" src="media/jquery02.js"></script>
<script type="text/javascript">
$(function() { $('.lightbox').lightBox(); });
</script>
</head>
<body>
<div id="bg_top">
  <div id="wrapper">
    <div id="header">
      <div id="logo"><img src="media/logo0000.png" width="289" height="54" alt="Logo" /></div>
      <div id="cloud1" class="special_font"><!-- texto aqui --><br /> <!-- texto aqui-->  </div>
      <div id="cloud2" class="special_font"> <!-- Numero de extension --> </div>
      <div id="menu">
        <ul id="navigation">
          <a  style="border:none;"> Sistema Integral de Bienestar Social</a>
        </ul>
      </div>
    </div>
    <div id="content_bg">
      <div id="content">
        
          <!--script type="text/javascript">
			 //<![CDATA[
			function loadmap() {
			 if (GBrowserIsCompatible()) {
			  var map = new GMap2(document.getElementById("googlemap"));
			  var geocoder = new GClientGeocoder();
			  map.setCenter(new GLatLng(57.4419, 74.1419), 13);
			  map.addControl(new GSmallMapControl());
			  //change the address below to the one you want the marker to point to
			  var address = "gold coast, qld, australia";
			  geocoder.getLatLng(
			      address,
			      function(point) {
			       if (!point) {
			         alert(address + " not found");
			       } else {
			         map.setCenter(point, 15);
			         var marker = new GMarker(point);
			         map.addOverlay(marker);
					  // change the address below to the one you want displayed in the popup
			         marker.openInfoWindowHtml(
			            "<strong>Company:</strong><br>Shop 5, 55 Retail Way,"+
			            " <br>Suburb 4444.");
			       }
			     }
			  );
			 }
			}
			window.onload=loadmap;
			//]]>
			</script-->
			
<!--script language="JavaScript" src="gen_validatorv4.js"
type="text/javascript" xml:space="preserve"></script>
<SCRIPT language=Javascript>
	function isNumberKey(evt) {
		var charCode = (evt.which) ? evt.which : event.keyCode
		if (charCode > 31 && (charCode < 48 || charCode > 57))
			return false;
		return true;
	}
</SCRIPT-->

<p align="center">
<?php 

$consulta="select cedula_usu, nac from user_login where cedula_usu = '$cedula_usu' and nac = '$nac'";

$consulta=pg_query($consulta);
while ($var = pg_fetch_array($consulta)) {
$consulta_nac = $var['nac'];
$consulta_cedula_usu = $var['cedula_usu']; }

if ($consulta_cedula_usu== "" and $consulta_nac == ""){
echo "Cedula No Registrada!";
}

if ($consulta_cedula_usu == $cedula_usu and $consulta_nac == $nac){

?>
</p>

<?php

				$Consultas = "select * from user_login where cedula_usu = '$cedula_usu' and nac = '$nac'";
				$resultados = pg_query($Consultas);
				?>
				</p>
				<?php

$linea= pg_fetch_array($resultados)
?>


		<table align="center" width="260px" height="150px">
		<td  align="center" width="250px">
          <h1> Consulta Usuario </h1>
          <br /> <br />
         <form name= "usuario" id= "usuario" method= "post" action= "modificar_usuario.php">
				<table width= "530" align= "center">
				<Tr>
                    <td width= "250"><font class= "color"> C&eacute;dula: <select name="nac"></font>
                    <option style="width:10px" value="<?php echo $linea['nac']; ?>"><?php echo $linea['nac']; ?></option>
<?php if ($linea['nac'] == "V"){ ?><option value="E">E</option>
<?php } if ($linea['nac'] == "E"){ ?><option value="V">V</option><?php } ?>
					</select>
					<input type= "text" readonly="" size= "15" maxlength = "15" name="cedula_usu" value="<?php echo $linea['cedula_usu']; ?>">
					</td>
					<td width= "250"><font class= "color"> Nombres: </font>
					<input type= "text" name="nombres_usu" value="<?php echo $linea['nombres_usu']; ?>">
					</td>
				</tr>
				<tr>
					<td><font class= "color"> Apellidos: </font>
					<input type= "text" name="apellidos_usu" value="<?php echo $linea['apellidos_usu']; ?>">
					</td>
					<td><font class= "color"> Tipo de Usuario: <select name="tipo_usuario"></font>
                    <option value="<?php echo $linea['tipo_usuario']; ?>"><?php echo $linea['tipo_usuario']; ?></option>
<?php if ($linea['tipo_usuario'] == "ADMINISTRADOR"){ ?><option value="ANALISTA">ANALISTA</option>
<?php } if ($linea['tipo_usuario'] == "ANALISTA"){ ?><option value="ADMINISTRADOR">ADMINISTRADOR</option><?php } ?>
					</select>
					</td>
				</tr>
				<tr>
					<td><font class= "color"> Usuario: </font>
					<input type= "text" name="usuario" value="<?php echo $linea['usuario']; ?>">
					</td>
					<td><font class= "color"> Password: </font>
					<input type= "text" name="password" value="<?php echo $linea['password']; ?>">
					</td>
				</tr>
				<tr>
					<td><font class= "color"> Palabra Clave: </font>
					<input type= "text" name="palabra_sec" value="<?php echo $linea['palabra_sec']; ?>">
					</td>
					<td><font class= "color"> Estatus: <select name="estatus_user"></font>
					<option value="<?php echo $linea['estatus_user']; ?>"><?php echo $linea['estatus_user']; ?></option>
<?php if ($linea['estatus_user'] == "ACTIVO"){ ?><option value="INACTIVO">INACTIVO</option>
<?php } if ($linea['estatus_user'] == "INACTIVO"){ ?><option value="ACTIVO">ACTIVO</option><?php } ?>
					</select>
					</td>
				</tr>
				<tr>
					<td>
						&nbsp;
					</td>
				</tr>
				<tr>
					<td colspan="2" align="center">
						<input type="submit" value="Modificar"/>
					</td>
				</tr>
		</table>
<?php
}
?>
					<p align="center">			
						<br>
						<a href="consulta_user.php"><img src="1356055280_Forward-64.png" height="30px" width="30px" /></a>
						</br>
						</p>
						</form>
        </td>
		</table>
          <p>&nbsp;</p>
        </div>
        <br class="clear" />
      </div>
      <br class="clear" />
    </div>
    <div id="content_bottom"><img src="media/content_.jpg" width="980" height="5" alt="bottom" /></div>
    <div id="footer">
     
    </div>
  </div>
</div>
<div id="grass">
  <div id="footer_design"> </div>
</div>
<script type="text/javascript"> Cufon.now(); </script>
</body>
</html>